package com.example.study.design.singleton;

/**
 * 懒汉模式-非线程安全
 *
 * @author duckquan
 */
public class LazyNonSecurity {

    /**
     * 私有构造方法
     */
    private LazyNonSecurity() {
    }

    /**
     * 在本类中创建私有静态的全局对象
     */
    private static LazyNonSecurity instance;

    /**
     * 通过判断对象是否被初始化,来选择是否创建对象
     *
     * @return
     */
    public static LazyNonSecurity getInstance() {
        if (instance == null) {
            instance = new LazyNonSecurity();
        }
        return instance;
    }

}
